package com.hzxy.yiyid.web.module.config;

import org.springframework.boot.web.server.ErrorPage;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;

/**
 * @ClassName InterceptorConfig
 * @Description TOOD
 * @Author RAICOM2023
 * @Date 2023/5/16 16:27
 * @Version 1.0
 **/
@Configuration
public class InterceptorConfig {

    @Bean
    public WebServerFactoryCustomizer webServerFactoryCustomizer(){
        return new WebServerFactoryCustomizer<ConfigurableServletWebServerFactory>() {
            @Override
            public void customize(ConfigurableServletWebServerFactory factory) {
                ErrorPage errorPage = new ErrorPage(HttpStatus.NOT_FOUND,"/index.html");
                factory.addErrorPages(errorPage);
            }
        };
    }

}
